package S13.first;

import java.util.ArrayList;
import java.util.List;
public class F02 {
	public static void main(String[] args) {
		List<Person>list=new ArrayList<Person>();
		list.add(new Person("zhangsan",19));
		list.add(new Person("lisi",22));
		list.add(new Person("wangwu",18));
		list.add(new Person("yangliu",20));
		System.out.println("集合中的所有记录：");
		list.forEach(p->System.out.println("\t"+p));

		list.removeIf(p->p.getAge()<20); //删除年龄小于20岁的元素
		System.out.println("删除年龄小于20岁元素后的所有记录：");
		list.forEach(p->System.out.println("\t"+p));
	}

}
